package com.zhouyu.user;

import com.zhouyu.spring.BeanPostProcessor;
import com.zhouyu.spring.Component;

/**
 * 自定义 BeanPostProcessor
 */
@Component
public class MyBeanPostProcessor implements BeanPostProcessor {

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) {

		if ("userService".equals(beanName)) {
			System.out.println("userService 初始化前");
		}

		return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) {
		if ("userService".equals(beanName)) {
			System.out.println("userService 初始化后");
		}

		return bean;
	}
}
